import Vue from 'vue'

import App from './App.vue'
// 引入路由
import router from './router/index.js'
import TypeNav from "@/components/TypeNav/index.vue";
// 引入vuex
import store from './store';
// 引入ElementUI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

// 引入mockServe.js模拟数据,让它至少执行一次
import '@/mock/mockServe.js'
// 引入swiper样式
import "swiper/css/swiper.css"
import Carousel from "@/components/Carousel/index.vue";
import Pagination from "@/components/Pagination/index.vue";
// 统一引入api
import * as API from "@/api"
import VueLazyload from "vue-lazyload";
import Image from "@/assets/logo.svg";
// 引入表单校验
import "@/plugins/validate"

Vue.config.productionTip = false
// 注册全局组件
Vue.component(TypeNav.name, TypeNav)// 三级菜单联动
Vue.component(Carousel.name, Carousel)// 轮播图
Vue.component(Pagination.name, Pagination)// 分页器
Vue.use(ElementUI);
Vue.use(VueLazyload, {
    loading: Image,
});

new Vue({
    router,// 注册路由,使得所有组件实例身上都有$route、$router属性
    store,// 注册vuex，使得所有组件实例身上都有$store属性
    beforeCreate() {
        // 配置全局事件总线
        Vue.prototype.$bus = this
        // 配置全局api
        Vue.prototype.$API = API
    },
    render: (h) => h(App)
}).$mount('#app')
